package com.itc.bi.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.itc.bi.entity.SysDictDataEntity;
import com.itc.bi.service.SysDictDataService;
import com.itc.common.core.domain.R;
import com.itc.common.core.utils.StringUtils;
import com.itc.system.api.domain.SysDictData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @BelongsProject: itc-airport-cloud
 * @BelongsPackage: com.itc.bi.controller
 * @Author: hecaiy
 * @CreateTime: 2024-07-23  18:19
 * @Description: TODO
 * @Version: 1.0
 */
@RestController
@RequestMapping("/dict/data")
@Api(value = "sysDictData", tags = "数据字典信息管理")
public class SysDictDataController {

    @Autowired
    private SysDictDataService sysDictDataService;

    /**
     * 根据字典类型查询字典数据信息
     */
    @ApiOperation(value = "根据字典类型查询字典数据信息")
    @GetMapping(value = "/type/{dictType}")
    public R<List<SysDictDataEntity>> getDictType(@PathVariable("dictType") String dictType){
        List<SysDictDataEntity> data = sysDictDataService.list(Wrappers.<SysDictDataEntity>lambdaQuery().eq(SysDictDataEntity::getDictType, dictType));
        return R.ok(data);
    }
}
